/*
 * MyFrame.java
 *
 * Created on 22 de febrero de 2009, 06:55 PM
 */

package Utils;

import java.awt.Color;
import javax.swing.*;
import java.awt.*;
import Utils.*;
import Behaviors.Arbitrators.*;
import Behaviors.*;

/**
 *
 * @author  alejo
 */
public class VectorFrame extends javax.swing.JFrame {

    private int maxSizeVec = 100;

    public static final int VECTOR_ELEMENT = 0;
    public static final int CIRCLE_ELEMENT = 1;

    public static final int POLAR_COORD = 0;
    public static final int CARTESIAN_COORD = 1;

    private int planeType;
    private int div1,div2;
    /** Creates new form MyFrame */
    public VectorFrame(String frameName,int planeType, int div1, int div2) {

        super(frameName);
        this.planeType = planeType;
        this.div1 = div1;
        this.div2 = div2;


        initComponents();

    }

    public void addDynElement(String name, int type, float radius, float x,float y, Color color)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).addDynElement(name, type, radius, x, y, color);
    }

    public void drawTable(boolean isTableEnabled)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).drawTable(isTableEnabled);
    }

    public void resetDynElements()
    {
        ((panelCoordPlane)this.jPanelCoordPlane).resetDynElements();
    }

    //TODO: falta agregar una funcion que permita eliminar estos elementos estaticos
    public void addStaticElement(String name, int type, float radius, float x, float y, Color color)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).addStaticElement(name, type, radius, x, y, color);
    }

    public void resetStaticElements(int index)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).resetStaticElements();
    }

    public void setSectorColor(int index,Color color)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).setSectorColor(index, color);
    }

    public void setOccupiedSector(int index)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).setOccupiedSector(index);
    }

    public void setFreeSector(int index)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).setFreeSector(index);
    }

    public void rotate(float angle)
    {
        ((panelCoordPlane)this.jPanelCoordPlane).rotate(angle);
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanelCoordPlane = new panelCoordPlane(planeType,div1,div2);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));

        jPanelCoordPlane.setBackground(new java.awt.Color(254, 254, 254));
        jPanelCoordPlane.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout jPanelCoordPlaneLayout = new javax.swing.GroupLayout(jPanelCoordPlane);
        jPanelCoordPlane.setLayout(jPanelCoordPlaneLayout);
        jPanelCoordPlaneLayout.setHorizontalGroup(
            jPanelCoordPlaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 396, Short.MAX_VALUE)
        );
        jPanelCoordPlaneLayout.setVerticalGroup(
            jPanelCoordPlaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 375, Short.MAX_VALUE)
        );

        jPanel1.add(jPanelCoordPlane);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelCoordPlane;
    // End of variables declaration//GEN-END:variables
    
}

